package edu.jd.movieplatform.admin.a_movie;

import edu.jd.movieplatform.common.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/admin/a_movie")
public class a_MovieAPI {
    @Resource
    private a_MovieService a_movieService;

    @GetMapping("")
    public Result a_movieList(a_MovieDto dto){
        Map<String,Object> page = a_movieService.geta_MovieList(dto);
        return Result.success(page);
    }

    @DeleteMapping("/{id}")
    public Result movieDelete(@PathVariable Integer id){
        a_movieService.deleteMovie(id);
        return Result.success();
    }

    @PostMapping("")
    public Result movieAdd(@RequestBody a_MovieDto dto){
        a_movieService.addMovie(dto);
        return Result.success();
    }

    @PutMapping("")
    public Result movieUpd(@RequestBody a_MovieDto dto){
        a_movieService.updMovie(dto);
        return Result.success();
    }
}
